6 struct MapRenderView: View {
8 @Binding var document: MapDocument
9 @Binding var evolution: StageType
12 Stage.stages(evolution)
15 var parsedMap: ParsedMap {
16 MapParser.parse(content: document.text)
19 let mapSize = Dimensions.mapSize
20 let padding = Dimensions.mapPadding
22 let lineWidth = CGFloat(0.5)
23 let vertexSize = CGSize(width: 25.0, height: 25.0)
25 var onDragVertex: (Vertex, CGFloat, CGFloat) -> Void = { _, _, _ in }
28 ZStack(alignment: .topLeading) {
33 x: -padding, y: -padding, width: mapSize.width + padding * 2,
34 height: mapSize.height + padding * 4))
37 MapStages(mapSize: mapSize, lineWidth: lineWidth, stages: parsedMap.stages)
39 mapSize: mapSize, lineWidth: lineWidth, evolution: stage, stages: parsedMap.stages)
41 mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize, edges: parsedMap.edges)
42 MapBlockers(mapSize: mapSize, vertexSize: vertexSize, blockers: parsedMap.blockers)
44 mapSize: mapSize, vertexSize: vertexSize, vertices: parsedMap.vertices,
45 onDragVertex: onDragVertex)
47 mapSize: mapSize, lineWidth: lineWidth, vertexSize: vertexSize,
48 opportunities: parsedMap.opportunities)
49 MapGroups(mapSize: mapSize, vertexSize: vertexSize, groups: parsedMap.groups).drawingGroup(
53 mapSize: mapSize, lineWidth: lineWidth, notes: parsedMap.notes)
54 }.offset(x: padding, y: padding).frame(
55 width: mapSize.width + 2 * padding,
56 height: mapSize.height + 2 * padding, alignment: .topLeading
63 document: Binding.constant(MapDocument(text: "")),
64 evolution: Binding.constant(StageType.general)